Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Apply the "safe bool" idiom to ConfigureQueueStatus #590

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vinay-deshmukh
Copy link
Collaborator

@vinay-deshmukh vinay-deshmukh commented Jan 29, 2025

Issue number of the reported bug or feature request: #350

Describe your changes

Apply safe bool idiom

Testing performed
Describe the testing you have performed to ensure that the bug has been addressed, or that the new feature works as planned.

Assuming CI has existing tests for the component

Additional context
Add any other context about your contribution here.

@vinay-deshmukh vinay-deshmukh requested a review from a team as a code owner January 29, 2025 02:19
Signed-off-by: Vinay Deshmukh <[email protected]>
@vinay-deshmukh vinay-deshmukh changed the title Apply the "safe bool" idiom to ConfigureQueueStatus Fix: Apply the "safe bool" idiom to ConfigureQueueStatus Jan 29, 2025
@chrisbeard
Copy link
Contributor

I believe the test failures are not related. @hallfox want to take a quick look?

// Use of an `UnspecifiedBool` to prevent implicit conversions to
// integral values, and comparisons between different classes which
// have boolean operators.
typedef bsls::UnspecifiedBool<ConfigureQueueStatus>::BoolType BoolType;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type definition should be private

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pretty much copied bmqa_closequestatus.h's typedef from:

public:
// TRAITS
BSLMF_NESTED_TRAIT_DECLARATION(CloseQueueStatus, bslma::UsesBslmaAllocator)
// TYPES
// Use of an `UnspecifiedBool` to prevent implicit conversions to
// integral values, and comparisons between different classes which
// have boolean operators.
typedef bsls::UnspecifiedBool<CloseQueueStatus>::BoolType BoolType;

  1. Should that be made private as well?

  2. If the typedef becomes private, would the public BoolType operator() const even be usable to clients?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants